#include<vector>


int longestOnes(std::vector<int>& nums, int k) {
    int zero = 0, ret = 0;
    for (int left = 0, right = 0; right < nums.size(); right++)
    {
        if (nums[right] == 0) zero++;
        while (zero > k)
        {
            if (nums[left] == 0) zero--;
            left++;
        }
        ret = std::max(ret, right - left + 1);
    }
    return ret;
}
int main()
{
    return 0;
}